package com.smart.manager.work.entities.models;

import com.smart.common.entities.core.BaseLongModel;
import com.smart.manager.member.entities.views.MemberPigView;
import com.smart.manager.product.entities.views.BasicPigstyView;
import com.smart.manager.work.entities.assembler.WorkOrder;
import com.smart.manager.work.entities.enums.PigOrderKind;
import com.smart.manager.work.entities.enums.PigOrderStatus;
import com.smart.manager.work.views.BasicStaffView;
import io.ebean.annotation.DbArray;
import io.ebean.annotation.DbJson;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.time.LocalDateTime;
import java.util.List;


/**
 * 猪仔订单
 */
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@Accessors(chain = true)
@Table(name = "work_pig_order_foods")
public class PigOrderFoods extends BaseLongModel {

    @ApiModelProperty("工单编号")
    private String code;

    @ApiModelProperty("管家信息")
    @ManyToOne
    @JoinColumn(name = "staff",referencedColumnName = "code")
    private BasicStaffView staff;

    @ApiModelProperty("所属猪圈")
    @ManyToOne
    @JoinColumn(name = "pigsty",referencedColumnName = "code")
    private BasicPigstyView pigsty;

    @ApiModelProperty("猪仔详情")
    private transient List<MemberPigView> pigDetail;

    @ApiModelProperty("猪仔代码")
    @DbArray
    private List<String> pigCodeList;

    @ApiModelProperty("订单状态")
    private PigOrderStatus status;

    @ApiModelProperty("订单类型")
    private PigOrderKind kind;

    @ApiModelProperty("喂食内容")
    @DbJson
    private WorkOrder.FeedBody content;

    @ApiModelProperty("完成时间")
    private LocalDateTime completeTime;

    @ApiModelProperty("视频地址")
    private String video;

    @ApiModelProperty("任务ID")
    private String taskId;

    @ApiModelProperty("摄像头")
    private transient List<String> cameraUrl;

}
